﻿@using Subfaculty.WebApplication.ViewModels
@model AllocationViewModel
@{
	ViewBag.Title = "Раскладка";
	Layout = "~/Views/Shared/_Layout.cshtml";
	}
	
@*using (Ajax.BeginForm(
	"GetViewHome2", 
	"Navigation",
	new AjaxOptions() { HttpMethod = "get"}))
{
	<fieldset class="main_fieldset">
		<legend class="main_legend">Содержимое</legend>
		<h2>@ViewBag.Message</h2>

		@{
			Html.Telerik().Grid(Model)
				.Name("Grid")
				.ToolBar(commands => commands.Insert().ButtonType(GridButtonType.BareImage).ImageHtmlAttributes(new {style = "margin-left:0"}))
				.DataKeys(keys => keys.Add(c => c.Id))

				.Columns(columns =>
				         	{
								columns.Bound(o => o.Title);
								columns.Bound(o => o.Abbreviation);
								columns.Command(commands =>
								                	{
														commands.Edit().ButtonType(GridButtonType.BareImage);
														commands.Delete().ButtonType(GridButtonType.BareImage);
													}).Width(180).Title("Commands");
							}
				)
				.DataBinding(dataBinding =>
				             	{
									dataBinding.Server().Select("GetViewHome2", "Navigation", new {ajax = true});
									dataBinding.Ajax().Select("_GetViewHome2", "Navigation").Enabled(true);
									dataBinding.Ajax()
										.Select("_SelectAjaxEditing", "Navigation")
										.Insert("_InsertAjaxEditing", "Navigation")
										.Update("_SaveAjaxEditing", "Navigation")
										.Delete("_DeleteAjaxEditing", "Navigation");
								})
				.Editable(editing => editing.Mode(GridEditMode.PopUp))

				.Scrollable(scrolling => scrolling.Enabled(true))
				.Scrollable(scrolling => scrolling.Height("450px"))
				.Sortable(sorting => sorting.Enabled(true))
				.Pageable(paging => paging.Enabled(true))
				.Filterable(filtering => filtering.Enabled(true))
				.Selectable(s => s.Enabled(false))
				.Groupable(grouping => grouping.Enabled(true))
				.Footer(true)
				.Render();
		}
	</fieldset>
}

*@
<fieldset class="main_fieldset">
<legend class="main_legend">Деканская раскладка</legend>

Направление: @Model.StudyArea
<br/>
Год поступления: @Model.StudyYear
<br/>
<h3>Раскладка:</h3>
<br/>
@{ Html.Telerik().Grid(Model.AllocationItems)
	.Name("Grid")
	.DataKeys(keys => keys.Add(c => c.HoursLab))
	.ToolBar(toolBar => toolBar.Template(
		@<text>
		 	<label class="customer-label" for="Customers-input">
				Кафедра:
			</label>
		 	@(Html.Telerik().ComboBox()
														.Name("Department")
		                                .DataBinding(binding => binding.Ajax().Select("_GetDepartment", "Allocation"))
		                                .AutoFill(true)
		                                .HtmlAttributes(new {style = "width: 300px"})
		                                .HighlightFirstMatch(true)
		                                .SelectedIndex(0)
		                                             		                                 	
		)
		<label class="customer-label" for="Customers-input">
				   Учебный год:
			</label>
		 	@(Html.Telerik().ComboBox()
		                                .Name("Years")
														.DataBinding(binding => binding.Ajax().Select("_GetYears", "Allocation"))
		                                .AutoFill(true)
		                                .HtmlAttributes(new {style = "width: 300px"})
		                                .HighlightFirstMatch(true)
		                                .SelectedIndex(0)
		                                             		                                 	
		)
		 @item.CustomCommandToolBarButton("viewDetails", "Сформировать нагрузку", "ViewCustomerDetails", "Grid", null, true,
        GridButtonType.Text)
		 </text>))
	.Columns(columns =>
	         	{
					columns.Bound(o => o.Semester);
					columns.Bound(o => o.Discipline);
					columns.Bound(o => o.HoursLab);
					columns.Bound(o => o.HoursLecture);
					columns.Bound(o => o.HoursPractice);
					columns.Bound(o => o.HoursSRS);
					columns.Bound(o => o.ETypeSRS);
					columns.Bound(o => o.EStudyControl);
					columns.Bound(o => o.Department);
					columns.Bound(o => o.StudyGroups);
				})

	.Editable(editing => editing.Mode(GridEditMode.PopUp))
	.Scrollable(scrolling => scrolling.Enabled(true))
	.Scrollable(scrolling => scrolling.Height("600px"))
	.Sortable(sorting => sorting.Enabled(true))
	.Pageable(paging => paging.Enabled(true))
	.Filterable(filtering => filtering.Enabled(false))
	.Selectable(s => s.Enabled(true))
	.Groupable(grouping => grouping.Enabled(true))
	.Footer(true).Render();
}
</fieldset>